package me.magicall.test.type;

import java.io.File;

public class GetClassFromPackage {
//	public static void main(final String[] args) {
//		System.out.println("@@@@@@GetClassFromPackage.main():" + getClasses(GetClassFromPackage.class.getPackage()));
//	}

	/*
	 * 取得某一类所在包的所有类名 不含迭代
	 */
	public static String[] getPackageAllClassName(final String classLocation, final String packageName) {
		//将packageName分解
		final String[] packagePathSplit = packageName.split("[.]");
		String realClassLocation = classLocation;
		final int packageLength = packagePathSplit.length;
		for (int i = 0; i < packageLength; i++) {
			realClassLocation = realClassLocation + File.separator + packagePathSplit[i];
		}
		final File packeageDir = new File(realClassLocation);
		if (packeageDir.isDirectory()) {
			final String[] allClassName = packeageDir.list();
			return allClassName;
		}
		return null;
	}

}
